package com.gxa.xc.rbac.controller;


import com.gxa.xc.rbac.Service.impl.LoginService;
import com.gxa.xc.rbac.dto.ResultDTO;
import com.gxa.xc.rbac.pojo.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private LoginService loginService;
    @GetMapping("/page")
    public String login(){
        return "login";
    }

    @PostMapping("/do")
    @ResponseBody
    public ResultDTO loginDo(Admin admin, HttpSession session){
        return loginService.login(admin, session);
    }
}
